<?php echo $this->css('css/events.css'); ?>

<div class="cms-form-message"> Fill in the fields below to edit the contents of the selected article </div>
<form action="<?php echo $this->url(array('action' => 'edit', 'id' => $event->getId())); ?>" method="post" name="form2" id="EventEditForm">
    <table align="center" cellpadding="6" cellspacing="0">
        <tr >
            <td width="74" align="right" nowrap="nowrap" class="sectionTitle1">Category:</td>
            <td width="530">
                <select name="EventCategory">
                    <option value="">Select Event Category</option>
                    <?php
					foreach($categories as $category) {
						$selected = $category->getId() == $event->getCategory()->getId() ? "selected=selected" : "";
					?>
                    <option value="<?php echo $category->getId(); ?>" <?php echo $selected; ?>><?php echo $category->getCategoryName(); ?></option>
                    <?php }  ?>
                </select>
            </td>
        </tr>
        <tr >
            <td align="right" nowrap="nowrap" class="sectionTitle1"> Event Title: </td>
            <td>
                <input type="text" id="EventName" name="EventName" value="<?php echo htmlentities($event->getName(), ENT_COMPAT, 'iso-8859-1'); ?>" size="60" />
            </td>
        </tr>
        <tr >
            <td align="right" class="sectionTitle1"> Title Alias: </td>
            <td colspan="2">
                <label for="FriendlyURL"></label>
                <input name="FriendlyURL" type="text" class="alias" id="FriendlyURL" style="width: 92%;" value="<?php echo $event->getData('FriendlyURL'); ?>" size="65" />
            </td>
        </tr>
        <tr >
            <td align="right" valign="top" nowrap="nowrap" class="sectionTitle1">Description:</td>
            <td>
                <textarea id="EventDesc" name="EventDesc" cols="70" rows="25"><?php echo htmlentities($event->getDescription(), ENT_COMPAT, 'iso-8859-1'); ?></textarea>
            </td>
        </tr>
        <tr >
            <td align="right" nowrap="nowrap" class="sectionTitle1">Time:</td>
            <td>
                <input type="text" name="Time" value="<?php echo htmlentities($event->getTime(), ENT_COMPAT, 'iso-8859-1'); ?>" size="18" />
            </td>
        </tr>
        <tr >
            <td align="right" valign="top" nowrap="nowrap" class="sectionTitle1">Date:</td>
            <td>
                <div class="checkDiv" id="singleDaySel">
                    <input <?php if (!(strcmp($event->getData('EventDuration'),"single"))) {echo "checked=\"checked\"";} ?> type="radio" name="EventDuration" id="singleCheck" value="single" onclick="showDateArea('#single')" />
                    <label for="singleCheck">Single Day Event</label>
                </div>
                <div class="dateDiv" id="single" style="display:block; height: 30px;">
                    <input type="text" name="Date" id="Date" value="<?php echo htmlentities($event->getStartDate('Y-m-d'), ENT_COMPAT, 'iso-8859-1'); ?>" size="12" />
                </div>
                <div class="checkDiv" id="periodSel">
                    <input <?php if (!(strcmp($event->getData('EventDuration'),"period"))) {echo "checked=\"checked\"";} ?> type="radio" name="EventDuration" id="periodCheck" value="period" onclick="showDateArea('#period')" />
                    <label for="periodCheck">Period Event</label>
                </div>
                <div class="dateDiv" id="period" style="display:none; height: 30px;">
                    <table width="361" border="0" cellpadding="2" cellspacing="0">
                        <tr>
                            <td>From:</td>
                            <td>
                                <input name="StartDate" id="StartDate" value="<?php echo $event->getStartDate('Y-m-d'); ?>" size="12" />
                            </td>
                            <td>To: </td>
                            <td>
                                <input name="EndDate" id="EndDate" value="<?php echo $event->getEndDate('Y-m-d'); ?>" size="12" />
                            </td>
                        </tr>
                    </table>
                </div>
            </td>
        </tr>
        <tr >
            <td align="right" nowrap="nowrap" class="sectionTitle1">Venue:</td>
            <td>
                <input type="text" name="Venue" value="<?php echo htmlentities($event->getVenue(), ENT_COMPAT, 'iso-8859-1'); ?>" size="50" />
            </td>
        </tr>
        <tr >
            <td nowrap="nowrap" align="right">&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td colspan="2" align="center" nowrap="nowrap">
                <input type="submit" class="sectionTitle1" value="Save Changes" />
                <input name="button2" type="button" class="sectionTitle1" id="button2" onclick="if( confirm('Cancel Update of Selected Event Information?') ) location.href = '<?php echo $this->url(array('module' => 'events')); ?>'; " value="Cancel Update" />
            </td>
        </tr>
    </table>
    <input type="hidden" name="AssocImage" value="<?php echo htmlentities($event->getData('AssocImage'), ENT_COMPAT, 'iso-8859-1'); ?>" />
    <input type="hidden" name="MM_update" value="form2" />
    <input type="hidden" name="id" value="<?php echo $event->getId(); ?>" />
</form>

<script type="text/javascript" src="scripts/friendurl/jquery.friendurl.min.js"></script>
<script type="text/javascript" src="scripts/tiny_mce/tiny_mce.js"></script>
<?php echo $this->script('js/events.js'); ?>
